<template>
  <div v-if="Object.keys(goods).length !==0" class="base-info">
    <div class="info-title">{{goods.title}}</div>
    <div class="info-price">
      <span class="new-price">{{goods.newPrice}}</span>
      <span class="old-price">{{goods.oldPrice}}</span>
      <span v-if="goods.discount" class="discount">{{goods.discount}}</span>
    </div>
    <div class="info-columns">
      <span>{{goods.columns[0]}}</span>
      <span>{{goods.columns[1]}}</span>
      <span>{{goods.services[goods.services.length-1].name}}</span>
    </div>
    <div class="info-services">
          <span class="info-services-item" v-for="index in goods.services.length-1" :key="index">
              <img :src="goods.services[index-1].icon" alt="">
              <span>{{goods.services[index-1].name}}</span>
          </span>
    </div>
  </div>
</template>

<script>
  export default {
    name: "DetailBaseInfo",
    props: {
      goods: {
        type: Object,
        default() {
          return {}
        }
      }
    }
  }

</script>
<style scoped>
  .info-title {
    font-size: 16px;
    font-weight: 600;
    margin: 10px 0;
  }

  .info-price .new-price {
    font-size: 20px;
    font-weight: 600;
    color: rgb(255, 94, 107);
  }

  .info-price .old-price {
    color: #aaa;
  }

  .info-price .discount {
    color: #fff;
    background-color: rgb(255, 94, 107);
  }

  .info-columns {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
    color: #999;
  }

  .info-services {
    display: flex;
    justify-content: space-between;
    line-height: 60px;
    border-top: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    margin-top: 5px;
  }

  .info-services-item img {
    width: 14px;
    height: 14px;
  }
</style>
